export enum SocketEventType { // 这个其实是前后端公用的枚举，类似于luoshu-share
    // server端监听的消息类型
    HeartBounce,
    ChatMessage,
    DdzGame
}

export enum SocketDataType {
    InviteFriend,
    AcceptInvite,
    RejectInvite,
    OutCard,
    Double,
    QuitGame,
    ChangeStatus
}

// 客户端监听的类型和服务端不一定一致，比如服务器监听的事件是客户端发送的心跳，但是对应客户端并不需要监听所谓的心跳，客户端需要监听那些用户状态发生了变化
// 因此我们要针对于客户端和服务端维护两组不同的事件类型

export enum ClientSocketEventType { // 这个其实是前后端公用的枚举，类似于luoshu-share
    // client 端监听的消息类型
    UserStatusChange,
    ChatMessage,
    InviteFriend,
    AcceptInvite,
    RejectInvite,
    OutCard,
    Double,
    QuitGame,
    GameOver,
    ChangeStatus
}

export enum CardIconType {
    RedHeart, // 红桃
    BlackHeart, // 黑桃
    PlumBlossom, // 梅花
    Square // 方块
}
export interface CardType {
    cardNum: number,
    cardIcon?: CardIconType // 可选参数，因为大王小王没有这四个icon
}
export interface DoubleMsgType {
    gameid: string,
    player: string,
    doubleType: DoubleType,
    multiple: number,
    isCompleteDouble: boolean,
    completeDoublePlayer: string[],
    needbroadcast: boolean
}

export enum OutCardType {
    EMPTY_CARD_FLAG = 'EMPTY_CARD_FLAG',
    None = 'none',
    Single = 'single',
    Double = 'double',
    Three = 'three',
    ThreeWithOne = 'threeWithOne',
    ThreeWithTwo = 'threeWithTwo',
    FourWithTwo = 'fourWithTwo',
    FourWithFour = 'fourWithFour',
    Shunzi = 'shunzi',
    ConnectedPair = 'connectedPair',
    AirFly = 'airFly',
    AirFlyWithOne = 'airFlyWithOne',
    AirFlyWithTwo = 'airFlyWithTwo',
    Bomb = 'bomb',
    KingBomb = 'kingBomb'
}

export interface OutCardInfo { // 需要广播给其他客户端的出牌信息
    type: OutCardType,
    compareNum: number, // 从左到右依次对比大小
    rawCards: CardType[],
    connectSize?: number;
}

export interface PlayerOutCardInfo {
    playerName: string;
    outCardInfo?: OutCardInfo;
}

export interface PlayerType {
    name: string;
    status: boolean;
    nickname: string;
    hld: number;
    avatar: string;
    gender: boolean;
}

export enum GameStatus {
    Wait = 'wait',
    Gaming = 'gaming',
    GameOver = 'over'
}

export enum DoubleType { // 加倍类型
    None = 1,
    Double = 2,
    SuperDouble = 4
}

export interface SummaryHappyBean {
    name: string;
    nickname: string;
    lowScore: number;
    multiple: string;
    hld: number; // 欢乐豆变化
    isLandlord: boolean;
    isWin: boolean;
    resHld: number;
}
export type SummaryObjType = { [key: string]: SummaryHappyBean }